<?php

class indexAction extends sfAction
{

  public function execute( $request )
  {
    $this->redirectIf( !$this->getUser()->isAuthenticated(), '@sf_guard_signin' );
    $maxPerPage = 2;
    $page = $request->hasParameter( 'page' ) ? $request->getParameter( 'page' ) : 1;
    $query = Doctrine_Query::create()
            ->from( 'SykesCompetencyBasedInterviewGuide g' )
            ->orderBy( 'g.updated_at DESC' );
    $this->pager = new sfDoctrinePager( 'SykesCompetencyBasedInterviewGuide' );
    $this->pager->setPage( $page );
    $this->pager->setMaxPerPage( $maxPerPage );
    $this->pager->setQuery( $query );
    $this->pager->init();
  }

}